package com.spvs.approval.support;


import com.spvs.approval.domain.ApprovalFromEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
public class ApprovalBusinessContext {
    /**
     * 采购审批
     */
    public final static String TYPE_CG = "01";

    /**
     * 到货验收审批
     */
    public final static String TYPE_DH = "02";
    /**
     * 安装验收审批
     */
    public final static String TYPE_AZYS = "03";
    /**
     * 技术规格书审批
     */
    public final static String TYPE_JSGGS = "04";
    /**
     * 设备租赁审批
     */
    public final static String TYPE_SBZL = "05";
    /**
     * 设备退租审批
     */
    public final static String TYPE_SBTL = "06";
    /**
     * 设备停租审批
     */
    public final static String TYPE_SBTINGZ = "07";
    /**
     * 设备续租审批
     */
    public final static String TYPE_SBXZ = "08";
    /**
     * 入库审批
     */
    public final static String TYPE_RK = "09";
    /**
     * 出库审批
     */
    public final static String TYPE_CK = "10";
    /**
     * 技术协议
     */
    public final static String TYPE_JSXY = "11";
    /**
    /**
     * 普通类型
     */
    public final static String TYPE = "0";

    @Autowired
    private List<ApprovalBusinessCall> approvalBusinessCall;

    public void businessCall(String type, ApprovalFromEntity from,Integer userSort,Long userId) {
        approvalBusinessCall.forEach(item -> {
            if (item.isCall(type)) {
                item.callback(from,userSort,userId);
            }
        });
    }

}
